package com.ss.ttm.a;

import android.os.Environment;
import android.os.StatFs;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

public final class b {
    private static int a;
    private static int[] b;

    static {
        a = 0;
        b = new int[3];
    }

    public static long[] a() {
        long[] v0 = new long[2];
        if ("mounted".equals(Environment.getExternalStorageState())) {
            StatFs v2 = new StatFs(Environment.getExternalStorageDirectory().getPath());
            long v4 = ((long) v2.getBlockSize());
            long v6 = ((long) v2.getBlockCount());
            long v2_1 = ((long) v2.getAvailableBlocks());
            v0[0] = v6 * v4;
            v0[1] = v2_1 * v4;
        }

        return v0;
    }

    public static int b() {
        if (a == 0) {
            c();
            a = b[0];
        }

        return a;
    }

    private static int[] c() {
        BufferedReader v3 = null;
        InputStreamReader v2 = null;
        FileInputStream v1 = null;
        int v9 = 2;
        try {
            v1 = new FileInputStream("/proc/cpuinfo");
            v2 = new InputStreamReader(((InputStream) v1));
            v3 = new BufferedReader(((Reader) v2));
            String v0_2 = "processor";
            String v4 = "features";
            String v5 = "model name";
            do {
                String v6 = v3.readLine();
                if (v6 != null) {
                    String[] v6_1 = v6.replaceAll("\t", "").toLowerCase().split(":");
                    if (v6_1.length != v9) {
                        continue;
                    }

                    String v7 = v6_1[0].trim();
                    v6 = v6_1[1].trim();
                    if (v6 == null) {
                        continue;
                    }

                    if (v7 == null) {
                        continue;
                    }

                    if (v7.compareTo(v0_2) == 0) {
                        if (!v6.contains("armv") && !v6.contains("aarch64")) {
                            if (!v6.contains("intel")) {
                                continue;
                            }

                            b[0] = 2;
                        } else {
                            b[0] = 1;
                        }
                    } else {
                        if (v7.compareToIgnoreCase(v4) == 0) {
                            if (!v6.contains("neon") && !v6.contains("thumb") && !v6.contains("vfpv") && !v6.contains("asimd") && !v6.contains("simd")) {
                                continue;
                            }

                            b[0] = 1;
                            continue;
                        }

                        if (v7.compareToIgnoreCase(v5) != 0) {
                            continue;
                        }

                        if (v6.contains("intel")) {
                            b[0] = 2;
                        } else {
                            if (!v6.contains("arm")) {
                                continue;
                            } else {
                                b[0] = 1;
                            }
                        }
                    }
                }

                break;
            } while (true);


        } catch (Throwable v0_1) {
            v0_1.printStackTrace();
        }finally {
            try {
                v3.close();
                v2.close();
                ((InputStream) v1).close();
            } catch (Exception v0) {

            }
        }

        return b;
    }
}

